package demo;

import java.util.Arrays;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: ASUS
 * Date: 2023-11-06
 * Time: 16:57
 */
public class Test3 {
    public static void func(int[] array) {
        int left = 0;
        int right = array.length-1;
        while (left < right) {
            while (left < right && array[left] % 2 != 0) {
                left++;
            }
            while (left < right && array[left] % 2 == 0) {
                right--;
            }
            if (left<right){
                int tmp = array[left];
                array[left] = array[right];
                array[right] = tmp;
                left++;
                right--;
            }
        }
    }
    public static void main(String[] args) {
        int[] array = {1,3,5,7,9,11,};
        func(array);
        System.out.println(Arrays.toString(array));
    }
}
